Actors with Multi-headed Message Receive Patterns
نویسندگان
چکیده
The actor model provides the programmer with high-level concurrency abstractions to coordinate simultaneous computations by sending and receiving messages. Languages implementing the actor model such as Erlang commonly only support single-headed pattern matching over received messages. We propose and design an extension of Erlang style actors with receive clauses containing multi-headed message patterns. Patterns may be non-linear and constrained by guards. We provide a number of examples to show the usefulness of the extension. We also explore the design space for multi-headed message matching semantics, for example first-match and rule priority-match semantics. The various semantics are inspired by multi-set constraint matching semantics found in Constraint Handling Rules which provides us with a formal model to study actors with multi-headed message receive patterns. The system can be implemented efficiently and we have built a prototype as a library-extension to Haskell.
منابع مشابه
Event-Based Programming Without Inversion of Control
class Actor extends Thread { private var mailbox: List[Any] def !(msg: Any) = ... def receive[a](f: PartialFunction[Any, a]): a = ... ... } The ! method is used to send a message to an actor. The send syntax a!m is simply an abbreviation of the method call a.!(m), just like x+y in Scala is an abbreviation for x.+(y). The method does two things. First, it enqueues the message argument in the act...
متن کاملFloating Time Transition System: More Efficient Analysis of Timed Actors
The actor model is a concurrent object-based computational model in which event-driven and asynchronously communicating actors are units of concurrency. Actors are widely used in modeling real-time and distributed systems. Floating-Time Transition System (FTTS) is proposed as an alternative semantics for timed actors, and schedulability and deadlock-freedom analysis techniques have been develop...
متن کاملOwnership and Reference Counting based Garbage Collection in the Actor World
We propose Pony-ORCA, a fully concurrent protocol for garbage collection in the actor paradigm. It allows actors to perform garbage collection concurrently with any number of other actors. It does not require any form of synchronization across actors except those introduced through the actor paradigm, i.e. message send and message receive. Pony-ORCA is based on ideas from ownership and deferred...
متن کاملMulti-agent System Simulation in Scala: An Evaluation of Actors for Parallel Simulation
Multi-agent system (MAS) simulation, a growing field within artificial intelligence, requires the creation of high-performance, parallel, and user-friendly simulation frameworks. The standard approach is to use threads and shared memory. The drawbacks of this approach are the common concurrency pitfalls of race conditions and performance loss due to synchronization. Our goal was to evaluate the...
متن کاملStatechart-Based Actors For Modelling And Distributed Simulation Of Complex Multi-Agent Systems
This paper discusses the use of Theatre, a multi-agent simulation architecture, for the distributed simulation of discrete event systems (DESs) whose entities express complex behaviours. Complexity is dealt with by exploiting statechart-based actors which constitute the basic building blocks of a model. Actors are lightweight reactive autonomous agents that communicate to one another by asynchr...
متن کامل